import {Button, Form} from "antd";
import {useNavigate} from "react-router-dom";
import {InputFormItem} from "@/components/common/form/formItem";
import "./login.less";

const Login = () => {
    const nav = useNavigate();
    const [form] = Form.useForm();
    const onFinish = (values: any) => {
        if (values.password === values.username && values.password === "yq20230316") {
            nav("/home/user/list");
            localStorage.setItem("admin", "aaa");
        }
    };

    return (
        <div className="login-page">
            <Form form={form} className="form" onFinish={onFinish}>
                <InputFormItem label="账号" name="username" required />
                <InputFormItem label="密码" name="password" required type="password" />
                <Form.Item>
                    <Button type="primary" className="login" htmlType="submit">
                        确认登录
                    </Button>
                </Form.Item>
            </Form>
        </div>
    );
};

export default Login;
